<template>
	<view>
		<view class="header">
			<view class="top">账户余额(元)</view>
			<view class="money">{{account.money}}</view>
			<view class="user">
				<text>{{ account.name }}</text>|<text>{{account.unicode}}</text>
			</view>
			<view class="btn">
				<button plain="true" @click="goToDetail">查看账户信息</button>
			</view>
		</view>
		<view class="account">
			<view class="item" >
				<view class="title">
					我的缴存
				</view>
				<view class="tips">
					最近缴存{{store.create_time}}
				</view>
				<view class="money">
					{{store.money}}
				</view>
			</view>
			<view class="line"></view>
			<view class="item">
				<view class="title">
					我的提取
				</view>
				<view class="tips">
					最近提取{{out.create_time}}
				</view>
				<view class="money">
					{{out.money}}
				</view>
			</view>
		</view>
		<view class="detal">
			<button class="btn" @click="goToList(0)">查看明细</button>
		</view>
	</view>
</template>

<script>
	var app = getApp();
	var host = app.globalData.host,
		urls = app.globalData.urls;
	export default {
		onLoad(){
			var userInfo = uni.getStorageSync("setUserData"),that=this
			if(!userInfo){
				uni.reLaunch({
					url:"../login/login"
				})
			}
			let account = uni.getStorageSync('account')
			// if(!account){
				uni.request({
					url:host+urls.account,
					data:{
						partner_id:userInfo.id
					},
					method:'GET',
					success(res) {
						console.log('-------',res)
						that.account = res.data.data.info
						that.store = res.data.data.store
						that.out = res.data.data.get
						uni.setStorageSync('account',res.data.data.info)
					}
				})
			// }else{
			// 	that.account = account
			// }
			
		},
		onShow() {
		},
		data(){
			return {
				account:{
				},
				store:{},
				out:{}
			}
		},
		methods:{
			goToDetail(){
				uni.navigateTo({
					url:'detail'
				})
			},
			goToList(e){
				console.log('list',e)
				uni.navigateTo({
					url:'list?status='+e
				})
			}
		}
	}
</script>

<style>
	.top{
		margin-top: 25rpx;
	}
	.header{
		background-color: #2196f3;
		height: 260rpx;
		color: #ffffff;
		text-align: center;padding: 80rpx;
	}
	.header .money{
		font-size: 42rpx;
		font-weight: bold;
		margin: 20rpx 0;
	}
	.header .user{
		font-size: 28rpx;
		margin: 20rpx 0;
	}
	.user text{
		margin: 0 20rpx;
	}
	.btn{
		margin-top: 20rpx;
	}
	.btn button{
		width: 300rpx;
		border: 2rpx solid #ffffff;
		border-radius: 50rpx;
		padding: 5rpx 0;
		font-size: 26rpx;
		color: #ffffff;
		
	}
	.account{
		height: 200rpx;
		margin: 20rpx 10rpx;
		padding: 10rpx;
		color: #666;
	}
	.account .item{
		width: 43%;
		float: left;
		padding-left: 40rpx;
	}
	.item .title{
		font-weight: bold;
	}
	.item .tips{
		font-size: 24rpx;
		color: #999;
	}
	.item.money{
		font-size: 38rpx;
		color: #999;
	}
	.line{
		height: 120rpx;
		width: 2px;
		border-left: 1rpx solid #999;
		float: left;
	}
	.detal{
		text-align: center;
	}
	.detal .btn{
		width: 300rpx;
		background-color: #2196f3;
		color: #fff;
		padding: 0rpx 40rpx;
		border-radius: 60rpx;
		border: none;
	}
</style>
